package com.xidian.zhiancloud.scheduleTask;

import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.xidian.zhiancloud.model.Code;
import com.xidian.zhiancloud.service.chemicalsManagement.chemicalManager.CodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * 　　* @program zhiancloud
 * 　　* @author Egoist
 * 　　* @create 2021/3/22 12:59
 *
 */
@Component
public class DangerousManagerCodeSchedule {

    @Autowired
    private CodeService codeService;

    /**
     * 定时任务一 每天零点触发
     */
    @Scheduled(cron="0 0 0 * * ?")
    public void execute(){
        LambdaUpdateWrapper<Code> lambdaUpdateWrapper = new LambdaUpdateWrapper<Code>();
        lambdaUpdateWrapper.set(Code::getDangerousChemicalStorageCode, 1).set(Code::getDangerousChemicalOutCode, 1)
                .set(Code::getWasteStorageCode, 1).set(Code::getWasteOutCode, 1);
        codeService.update(null, lambdaUpdateWrapper);
    }
}
